#ifndef DWM_DB_H
#define DWM_DB_H 1

#include "user.h"

#include <map>
#include <vector>


/*
   design decision:
    - users will be owned by the db, loaded at the time of initialization. will have to handle indexing ourselves.
    */

class db
{

public: 
  static bool initialize();

  static bool finalize();

  static void notifyChange(User *);

  static User * getUserById(int);
  static User * getUserByUsername(const std::string&);
  static void insertUser(User *);

private:

  static std::vector<User*> m_users;
  static std::map<int, User*>    m_users_by_id;
  static std::map<std::string, User*> m_users_by_username;

  static void writeUsers();


  static unsigned int m_current_user_id;










};

#endif
